home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / C⁄C++ OS8 / Everything / ModalButtons.cp < prev    next >
Encoding:
Text File  |  1998-09-06  |  4.7 KB  |  189 lines  |  [TEXT/CWIE]

  1. // ModalButtons.cp -- Modal dialog
  2.  
  3. #include <Types.h>
  4. #include <Quickdraw.h>
  5. #include <Controls.h>
  6. #include <Dialogs.h>
  7. #include <Events.h>
  8. #include <Lists.h>
  9. #include <Menus.h>
  10. #include <TextEdit.h>
  11. #include <Appearance.h>
  12.  
  13. #include "ResourceDefs.h"
  14. #include "Miscellany.h"
  15. #include "ControlUtils.h"
  16.  
  17. #include "ModalButtons.h"
  18.  
  19. #define kCapInvisibleLabel        1
  20. #define kInvisibleButton        2
  21. #define kStandardButton        3
  22. #define kDefaultButton        4
  23. #define kBevelBox        5
  24. #define kButtonButton        6
  25. #define kNextButton        7
  26. #define kNext2Button        8
  27. #define kGraphicBox        9
  28. #define kCapcicnLabel        10
  29. #define kRightButton        11
  30. #define kCapicl8Label        12
  31. #define kLightButton        13
  32. #define kCapICNLabel        14
  33. #define kRight2Button        15
  34. #define kCapicl9Label        16
  35. #define kButton2Button        17
  36. #define kCapPICTLabel        18
  37. #define kRight3Button        19
  38. #define kRect3DButton        20
  39. #define kLeftIconButton        21
  40. #define kRightIconButton        22
  41. #define kTitledPICTButton        23
  42. #define kOKButton        24
  43.  
  44.  
  45. //----------
  46. // static
  47. Boolean        CModalButtons::GetModalButtons ()
  48. {
  49.     Boolean            result = false;
  50.     CModalButtons*        dialog = new CModalButtons;
  51.  
  52.     result = dialog->RunModal (DLOG_ModalButtons, nil);
  53.  
  54.     delete dialog;
  55.  
  56.     return result;
  57. }
  58.  
  59. //----------
  60. CModalButtons::CModalButtons ()
  61. {
  62. }
  63.  
  64. //----------
  65. CModalButtons::~CModalButtons ()
  66. {
  67. }
  68.  
  69. //----------
  70. void    CModalButtons::FinishMake ()
  71. {
  72.     mInvisibleHandle = GetControlItem (kInvisibleButton);
  73.     mStandardHandle = GetControlItem (kStandardButton);
  74.     mDefaultHandle = GetControlItem (kDefaultButton);
  75.     SetDefaultState (mDefaultHandle, true);
  76.     ::SetDialogDefaultItem (mDialog, kDefaultButton);
  77.     mBevelHandle = GetControlItem (kBevelBox);
  78.     mButtonHandle = GetControlItem (kButtonButton);
  79.     SetBevelButtonGraphicAlignment (mButtonHandle, kControlBevelButtonAlignCenter, 0, 0);
  80.     mNextHandle = GetControlItem (kNextButton);
  81.     SetBevelButtonTextPlacement (mNextHandle, kControlBevelButtonPlaceToRightOfGraphic);
  82.     SetBevelButtonTextAlignment (mNextHandle, kControlBevelButtonAlignTextFlushLeft, 0);
  83.     SetBevelButtonGraphicAlignment (mNextHandle, kControlBevelButtonAlignLeft, 0, 0);
  84.     mNext2Handle = GetControlItem (kNext2Button);
  85.     SetBevelButtonTextPlacement (mNext2Handle, kControlBevelButtonPlaceBelowGraphic);
  86.     SetBevelButtonTextAlignment (mNext2Handle, kControlBevelButtonAlignTextCenter, 0);
  87.     SetBevelButtonGraphicAlignment (mNext2Handle, kControlBevelButtonAlignTop, 0, 0);
  88.     mGraphicHandle = GetControlItem (kGraphicBox);
  89.     mRightHandle = GetControlItem (kRightButton);
  90.     mLightHandle = GetControlItem (kLightButton);
  91.     mRight2Handle = GetControlItem (kRight2Button);
  92.     mButton2Handle = GetControlItem (kButton2Button);
  93.     mRight3Handle = GetControlItem (kRight3Button);
  94.     mRect3DHandle = GetControlItem (kRect3DButton);
  95.     mLeftIconHandle = GetControlItem (kLeftIconButton);
  96.     mRightIconHandle = GetControlItem (kRightIconButton);
  97.     mTitledPICTHandle = GetControlItem (kTitledPICTButton);
  98.     mOKHandle = GetControlItem (kOKButton);
  99.     SetDefaultState (mOKHandle, true);
  100.     ::SetDialogDefaultItem (mDialog, kOKButton);
  101. }
  102.  
  103. //----------
  104. void    CModalButtons::ConnectToData (
  105.     AMSignaler*        inData)
  106. {
  107.     AMDialog::ConnectToData (inData);
  108.  
  109. }
  110.  
  111. //----------
  112. void    CModalButtons::DataChanged (
  113.     long        inDataID)
  114. {
  115. }
  116.  
  117.  
  118. //----------
  119. void    CModalButtons::DoItem (
  120.     SInt16        inItemHit)
  121. {
  122.     switch (inItemHit) {
  123.     case kInvisibleButton:
  124.             //? this button doesn't have a command
  125.             // DoInvisibleButton ();
  126.         break;
  127.     case kStandardButton:
  128.             //? this button doesn't have a command
  129.             // DoStandardButton ();
  130.         break;
  131.     case kDefaultButton:
  132.             //? this button doesn't have a command
  133.             // DoDefaultButton ();
  134.         break;
  135.     case kButtonButton:
  136.             //? this button doesn't have a command
  137.             // DoButtonButton ();
  138.         break;
  139.     case kNextButton:
  140.             //? this button doesn't have a command
  141.             // DoNextButton ();
  142.         break;
  143.     case kNext2Button:
  144.             //? this button doesn't have a command
  145.             // DoNext2Button ();
  146.         break;
  147.     case kRightButton:
  148.             //? this button doesn't have a command
  149.             // DoRightButton ();
  150.         break;
  151.     case kLightButton:
  152.             //? this button doesn't have a command
  153.             // DoLightButton ();
  154.         break;
  155.     case kRight2Button:
  156.             //? this button doesn't have a command
  157.             // DoRight2Button ();
  158.         break;
  159.     case kButton2Button:
  160.             //? this button doesn't have a command
  161.             // DoButton2Button ();
  162.         break;
  163.     case kRight3Button:
  164.             //? this button doesn't have a command
  165.             // DoRight3Button ();
  166.         break;
  167.     case kRect3DButton:
  168.             //? this button doesn't have a command
  169.             // DoRect3DButton ();
  170.         break;
  171.     case kLeftIconButton:
  172.             //? this button doesn't have a command
  173.             // DoLeftIconButton ();
  174.         break;
  175.     case kRightIconButton:
  176.             //? this button doesn't have a command
  177.             // DoRightIconButton ();
  178.         break;
  179.     case kTitledPICTButton:
  180.             //? this button doesn't have a command
  181.             // DoTitledPICTButton ();
  182.         break;
  183.     case kOKButton:
  184.             SetResult (true);
  185.         break;
  186.  
  187.     } // switch
  188. }
  189.